namespace DmServer.Handlers.Handlers;

public class MoveWindow : IMessageHandler
{
    public void HandleMessage(StringRequestInfo? request, TcpSessionClient client, DmSoft dm)
    {
        if (request?.Parameters == null || request.Parameters.Length != 3)
            client.SendAsync(CryptoHelper.EncryptDES("协议命令错误！"));

        int.TryParse(request?.Parameters?[0], out int hwnd);
        int.TryParse(request?.Parameters?[0], out int x);
        int.TryParse(request?.Parameters?[1], out int y);

        var result = dm.MoveWindow(hwnd, x, y);
        client.Logger.Info("MoveWindow：" + result.ToString());
        // 回复客户端消息
        client.SendAsync(CryptoHelper.EncryptDES(result.ToString()));
    }
}
